<template>
  <div class="featured-product">
    <img 
      :src="product.image" 
      :alt="product.name"
      class="featured-image"
    />
    <div class="featured-overlay">
      <h2 class="featured-title">{{ product.name }}</h2>
      <p class="featured-price">${{ product.price }}</p>
      <van-button 
        type="primary" 
        size="small"
        class="featured-button" 
        @click="onClick"
      >
        查看详情
      </van-button>
    </div>
  </div>
</template>

<script setup>
defineProps({
  product: {
    type: Object,
    required: true
  }
})

const emit = defineEmits(['click'])

const onClick = () => {
  emit('click')
}
</script>

<style scoped>
.featured-product {
  position: relative;
  height: 280px;
  overflow: hidden;
}

.featured-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px 16px;
  color: white;
}

.featured-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.featured-price {
  font-size: 18px;
  font-weight: 600;
  margin: 8px 0 16px;
}

.featured-button {
  align-self: flex-start;
  background-color: var(--primary-color) !important;
  border: none !important;
  font-weight: 500;
}
</style>